Databases and database products are in common use today. A database can store objects, such as records, tables, and indexes. Various operations performed on a database, such as deleting objects, can generate free space (memory) in the database. This free space is typically distributed throughout the database file, and thus cannot easily be removed from the database file. This free memory is problematic for databases, and particularly for mobile database products. Mobile database products are generally used on small, portable devices that have limited storage space and/or speed. Efficient use of storage is thus a goal of many mobile database products.
Current attempts to more efficiently utilize this free memory include a technique know as compacting. Compacting a database typically involves creating a new database, and then copying all objects from the source database to the new database. Compacting has the effect of not only removing empty pages from the database file, but also de-fragmenting the database. A fragmented database is one which has many non-empty pages, but the non-empty pages are only partially full. Typically, compacting is not initiated automatically (e.g., on a schedule or in response to some non-user-generated trigger) because the process of compacting is both processor and disk intensive, and thus generally takes the database out of service while the process is being performed—or, at least, slows the database to the point that the user would experience a noticeable impact on performance.
A desire exists for a technique for adjusting the size of a database that is appropriate to initiate automatically regardless of what the user is currently doing, that can be performed in the background relatively unnoticed by the user, and is relatively simple and efficient such that it can be implemented on products having a limited speed and/or memory.